<?php

namespace app\admin\command;

use think\console\Command;
use think\console\Input;
use think\console\Output;
use app\admin\model\AuthRule;

class ShowMenu extends Command
{
    protected function configure()
    {
        $this->setName('showmenu')
            ->setDescription('Show kuerp menu structure');
    }

    protected function execute(Input $input, Output $output)
    {
        // 查询kuerp模块的菜单
        $menus = AuthRule::where('name', 'like', 'kuerp%')
            ->where('status', 'normal')
            ->order('id', 'asc')
            ->select();

        foreach ($menus as $menu) {
            $output->writeln("ID: {$menu->id}, PID: {$menu->pid}, Name: {$menu->name}, Title: {$menu->title}, Icon: {$menu->icon}");
        }
    }
}